package com.zc.custom;

import org.springframework.context.ApplicationEvent;
import org.springframework.context.ApplicationListener;

public class CustomListener<T extends ApplicationEvent> implements ApplicationListener<T> {

    @Override
    public void onApplicationEvent(T event) {
        if (event instanceof CustomEvent) {
            System.out.println("CustomEvent:早点发财吧");
        }

        if (event instanceof CongEvent) {
            System.out.println("CongEvent:" + ((CongEvent) event).getMsg());
        }
    }

    @Override
    public boolean supportsAsyncExecution() {
        return ApplicationListener.super.supportsAsyncExecution();
    }
}
